Skip to content

Fix warnings in switch statements on clang#3943

Merged
danmar merged 4 commits intocppcheck-opensource:mainfrom
pfultz2:switch-warnings-pod-valuetype
Mar 30, 2022
Merged

Fix warnings in switch statements on clang#3943
danmar merged 4 commits intocppcheck-opensource:mainfrom
pfultz2:switch-warnings-pod-valuetype

Conversation

@pfultz2
Copy link
Copy Markdown
Contributor

@pfultz2 pfultz2 commented Mar 25, 2022

No description provided.

pfultz2 referenced this pull request Mar 25, 2022
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
Comment thread cmake/compileroptions.cmake Outdated
add_compile_options(-Wextra)
add_compile_options(-Wcast-qual) # Cast for removing type qualifiers
add_compile_options(-Wfloat-equal) # Floating values used in equality comparisons
# add_compile_options(-Wfloat-equal) # Floating values used in equality comparisons
Copy link
Copy Markdown
Collaborator

@firewave firewave Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also enable in the Makefile by default. If we no longer care about it we should just remove it everywhere.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I would agree with the warning but I believe there are some case in cppcheck code that we don't want to warn about.

Comment thread cmake/compileroptions.cmake Outdated
add_compile_options_safe(-Wno-implicitly-unsigned-literal)
add_compile_options_safe(-Wno-tautological-type-limit-compare)
add_compile_options_safe(-Wno-unused-member-function)
add_compile_options_safe(-Wno-deprecated-declarations)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be disabled since it shows us deprecated Qt functions. We need to disable it for the readdir_r case only.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be disabled for readdir_r only?

add_compile_options_safe(-Wno-extra-semi-stmt) # TODO: enable when warnings are fixed in in tinyxml2
add_compile_options_safe(-Wno-implicitly-unsigned-literal)
add_compile_options_safe(-Wno-tautological-type-limit-compare)
add_compile_options_safe(-Wno-unused-member-function)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enabled and the unused function needs to get the unused/maybe_unused attribute.

@pfultz2
Copy link
Copy Markdown
Contributor Author

pfultz2 commented Mar 27, 2022

Actually, I wasnt trying to fix all compiler warnings, I was disabling the outstanding ones so I can compile with -Werror. We should probably enable many of these warnings later, but I think we should open an issue for this.

@danmar danmar merged commit 32ded16 into cppcheck-opensource:main Mar 30, 2022
@pfultz2 pfultz2 deleted the switch-warnings-pod-valuetype branch March 31, 2022 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants